const search = require('../src/main/modules/search')
const Datastore = require('nedb-promises')

const dbFactory = (fileName) => Datastore.create({
  filename: `../data/${fileName}`,
  timestampData: true,
  autoload: true
})

const db = {
  sources: dbFactory('sources.db'),
  novels: dbFactory('novels.db')
}

(async () => {
  const sources = db.sources.find()
  for (let source of sources) {
    await search.downloadSearch(source, '临高启明')
  }
})
